package com.zpark.service.impl;

import com.zpark.dao.ScoreDao;
import com.zpark.dao.impl.ScoreDaoImpl;
import com.zpark.entity.Score;
import com.zpark.service.ScoreService;

import java.util.List;

public class ScoreServiceImpl implements ScoreService {
    private ScoreDao scoreDao = new ScoreDaoImpl();

    @Override
    public boolean addScore(Score score) {
        if (scoreDao.updateScore(score) > 0) {
            return true;
        }
        return false;
    }

    @Override
    public boolean editScore(Score score) {
       return this.addScore(score);
    }

    @Override
    public List<Score> getScoreByCourse(Integer courseId) {
        return scoreDao.selectScoreByCourseId(courseId);
    }

    @Override
    public List<Score> getScoreByStudent(Integer studentId) {
        return scoreDao.selectScoreByStudentId(studentId);
    }
}
